package sk.vrto.service.dao;

import sk.vrto.domain.Contact;
import sk.vrto.domain.ContactCreation;
import sk.vrto.domain.User;

import java.util.Collection;

/**
 * Repository that operates with the Contact entity.
 */
public interface ContactRepository extends Repository<Contact, String> {

    /**
     * Loads all contacts for the user currently logged in.
     * @param user User to filter contacts for
     * @return Loaded contacts
     */
    Collection<Contact> loadContatsForUser(User user);

    /**
     * For the given email address should either return existing contact,
     * or create a new one.
     * @param emailAddress Address to parse
     * @param forUser Logged user
     * @return Creation of contact
     */
    ContactCreation getOrCreate(String emailAddress, User forUser);

}
